Ext.define('HGMIDE.controller.InitController', {
			extend : 'Ext.app.Controller',
			config : {
				refs : {
					initConfirmBtn : '#initConfirmBtn'
				},
				control : {
					initConfirmBtn : {
						tap : 'doInit'
					}
				}
			},
			doInit : function() {
				var values = Ext.getCmp('init_panel').getValues();
				var developerModel = Ext.create('HGMIDE.model.DeveloperModel',
						{
							id : 0,
							name : values.name.trim(),
							email : values.email.trim(),
							ca : '-',
							password : values.password.trim()
						});
				if (values.name == null || values.name == '') {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.name_null,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				}
				var exp = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
				if (values.email == null || values.email == '') {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.email_null,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				} else if (!exp.test(values.email)) {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.email_format,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				}
				if (values.password == null || values.password == '') {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.newPwd_null,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				} else if (values.confirmPwd == null || values.confirmPwd == '') {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.newRePwd_null,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				} else if (values.password != null
						&& values.password != values.confirmPwd) {
					Ext.Msg.show({
					     message: I18N.error_message.developerError.pwd_different,
					     buttons: [
					    	 {text:'确定',itemId:'ok'},
					     ]
					});
					return;
				}
				Ext.Ajax.request({
							url : 'login',
							method:'POST',
							params : {
								action : 'init',
								name : values.name.trim(),
								email : values.email.trim(),
								ca : '-',
								password : values.password.trim()
							},
							success : function(response) {
								var text = response.responseText;
								if ('OK' == text.substring(0,
										text.indexOf(cmdFlag.CMDFlagSeperator))) {
									var json = Ext.JSON
											.decode(text
													.substring(text
															.indexOf(cmdFlag.CMDFlagSeperator)
															+ 1));
									developerModel.set('id', json.id);
									Util.currentDeveloper = developerModel;
									Ext.Viewport.add(Ext
											.create('HGMIDE.view.Main'));
									IDE.onload();
									Ext.getCmp('init_panel').hide();
								} else if (text == 'NO') {
									Ext.Msg.show({
									     message: I18N.init_fail,
									     buttons: [
									    	 {text:'确定',itemId:'ok'},
									     ]
									});
								}
							}
						});
			}
		});
